package cn.droidlover.xdroidmvp.base;

import java.util.List;

import cn.droidlover.xdroidmvp.kit.Kits;
import cn.droidlover.xdroidmvp.mvp.IPresent;

public abstract class PageListActivity<T, P extends IPresent> extends BaseListActivity<T, P> {


    @Override
    public void onSuccess(List<T> list) {
        disLoadDialog();
        mBaseAdapter.addList(isRefresh, list);
        twinkCompleted();
        if (!Kits.Empty.check(list)) {
            mStartIndex++;
        }
        if (0 == mBaseAdapter.getmList().size()) {
            super.showNoDataPage();
        } else {
            showMainView();
        }
        setTwinklingRefresh(list.size());
    }

    private void setTwinklingRefresh(int size) {
        if (size < 10) {
            mRefreshLayout.setEnableLoadmore(false);
        }
    }
}
